<template>
   <div style="height: 180px">
      <el-table
        ref="tblMain"
        style="margin-top: 20px"
        :data="listData"
        height="100%"
        v-loading.body="loading"
        border
        stripe
      >
        <el-table-column
          type="index"
          width="50"
          label="序号"
          align="center"
        ></el-table-column>
        <el-table-column prop="examineUserName" label="操作人" align="center" show-overflow-tooltip>
          <template slot-scope="scope">
            <span >{{ scope.row.examineUserName }}</span>
          </template>
        </el-table-column>
        <el-table-column prop="beforeState" label="操作前状态" align="center"  show-overflow-tooltip>
          <template slot-scope="scope">
            <span> {{ formatterFiled(scope.row.beforeState,'code','name',stateList) }}</span>
          </template>
        </el-table-column>
        <el-table-column prop="afterState" label="操作后状态" align="center"  show-overflow-tooltip>
          <template slot-scope="scope">
            <span> {{ formatterFiled(scope.row.afterState,'code','name',stateList) }}</span>
          </template>
        </el-table-column>
        <el-table-column prop="remark" label="操作备注" align="center"  show-overflow-tooltip>
          <template slot-scope="scope">
            <span >{{ scope.row.remark }}</span>
          </template>
        </el-table-column>
        <el-table-column prop="examineTime" label="操作时间" align="center" width="180">
          <template slot-scope="scope">
            <span >{{ scope.row.examineTime }}</span>
          </template>
        </el-table-column>
      </el-table>
    </div>
</template>
<script>
import {
  getExamLogList,
} from '@/api/businessCo'
export default {
  name: 'applyMain',
  props: {
    rowData:{
      type: Object,
      default: {}
    },
    stateList: {
      type: Array,
      default: []
    }
  },
  data() {
    return {
      loading: false,
      listData: [],
    }
  },
  created() {},
  mounted() {
    this.getExamLogList()
  },
  methods: {
    /**
     * 获取码值
     */
     formatterFiled(cellValue,key,val,list) {
      let item = list.find((item) => item[key] === cellValue)
      return item ? item[val] : ''
    },
    /**
     * 获取日志列表信息
     */
    getExamLogList() {
      let data={
        applyId:this.rowData.id
      }
      getExamLogList(data).then(res=>{
        const { code = undefined, data = {} } = res.data
        if (!code) {
          this.loading = false
          this.listData = data;
        } else {
          this.$message.error(data)
        }
        }).catch(() => {
          this.$message.error('服务器繁忙')
          this.loading = false
        })
    },
  }
}
</script>
